var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var UI_BoxInfo_UIBindings = require("AA_UI_BoxInfo_UIBindings");
var UIView = require("AA_UIView");
var Excel = require("AA_Excel");
var HallManager = require("AA_HallManager");
var UIManager = require("AA_UIManager");
var BundleConfig = require("AA_BundleConfig");
var UIConfig_Home = require("AA_UIConfig_Home");
var PlayerDataManager = require("AA_PlayerDataManager");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_UI_BoxInfo = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.auto_ui = null;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype._show = function (e) {
    this.infoData = e;
    var t = Excel.Excel.shopBoxLevel(HallManager.HallMgr.shopData.boxLevel + 1);
    this.auto_ui.txt_titleLabel.string = 0 == e.type ? "普通礼盒" : "精致礼盒";
    var o = 0 == e.type ? t.moneyCount : t.bigMoneyCount;
    var n = 0 == e.type ? t.rewards : t.bigRewards;
    this.auto_ui.txt_goldLabel.node.parent.active = o > 0;
    this.auto_ui.txt_goldLabel.string = "" + o;
    this.auto_ui.txt_lvLabel.node.parent.active = n[0] > 0;
    this.auto_ui.txt_lvLabel.string = "" + n[0];
    this.auto_ui.txt_lanLabel.node.parent.active = n[1] > 0;
    this.auto_ui.txt_lanLabel.string = "" + n[1];
    this.auto_ui.txt_ziLabel.node.parent.active = n[2] > 0;
    this.auto_ui.txt_ziLabel.string = "" + n[2];
    this.auto_ui.node_boxBG.children[0].active = 0 == e.type;
    this.auto_ui.node_boxBG.children[1].active = 1 == e.type;
    var i = Excel.Excel.shopControl(1);
    if (0 == e.type) {
      this.auto_ui.btn_videoBuyBtn.interactable = i.box1BuyCount - HallManager.HallMgr.shopData.box1BuyCount > 0;
    } else {
      this.auto_ui.btn_videoBuyBtn.interactable = i.box2BuyCount - HallManager.HallMgr.shopData.box2BuyCount > 0;
    }
    this.auto_ui.txt_priceLabel.string = "" + (0 == e.type ? i.boxPrice : i.bigBoxPrice);
    if (0 == e.type) {
      this.auto_ui.btn_buyBtn.interactable = PlayerDataManager.PlayerDataMgr.globalData.diamond >= i.boxPrice;
    } else {
      this.auto_ui.btn_buyBtn.interactable = PlayerDataManager.PlayerDataMgr.globalData.diamond >= i.bigBoxPrice;
    }
  };
  _creator.prototype._clickListener = function (e) {
    var t = this;
    switch (e) {
      case this.auto_ui.btn_buyBtn:
        this.infoData && this.infoData.clickCallBack && this.infoData.clickCallBack(false, function () {
          t._close();
        });
        break;
      case this.auto_ui.btn_videoBuyBtn:
        this.infoData && this.infoData.clickCallBack && this.infoData.clickCallBack(true, function () {
          t._close();
        });
        break;
      case this.auto_ui.btn_closeBtn:
        this._close();
        break;
      case this.auto_ui.btn_lvIconBtn:
        this.ShowEquipInfo(1);
        break;
      case this.auto_ui.btn_lanIconBtn:
        this.ShowEquipInfo(2);
        break;
      case this.auto_ui.btn_ziIconBtn:
        this.ShowEquipInfo(3);
    }
  };
  _creator.prototype.ShowEquipInfo = function (e) {
    UIManager.default.open(BundleConfig.BundleNames.Home, UIConfig_Home.UIView_Home.UI_BoxItemInfo, e);
  };
  __decorate([_property(UI_BoxInfo_UIBindings.default)], _creator.prototype, "auto_ui", undefined);
  return __decorate([_ccclass], _creator);
}(UIView.default);
exports.default = _def_UI_BoxInfo;